#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main(){
int a,b,c; a=1;
string s,z; z="";
cout << "Wait your input" << endl;
getline(cin,s);

for(int i=0; i<s.size(); i++){
	if(s[i]=='(' or s[i]=='[' or s[i]=='{' or s[i]=='<'){
		z+=s[i];
	}
	if(s[i]==')' or s[i]==']' or s[i]=='}' or s[i]=='>'){
		if(z[z.size()-1]=='(' and s[i]==')'){
		z.erase(z.size()-1,1);}
	else{if(z[z.size()-1]!='(' and s[i]==')'){
		a=0; break;}}

		if(z[z.size()-1]=='[' and s[i]==']'){
		z.erase(z.size()-1,1);}
	else{if(z[z.size()-1]!='[' and s[i]==']'){
		a=0; break;}}

		if(z[z.size()-1]=='{' and s[i]=='}'){
		z.erase(z.size()-1,1);}
	else{if(z[z.size()-1]!='{' and s[i]=='}'){
		a=0; break;}}

		if(z[z.size()-1]=='<' and s[i]=='>'){
		z.erase(z.size()-1,1);}
	else{if(z[z.size()-1]!='<' and s[i]=='>'){
		a=0; break;}}}}

if(a==0 or z.size()>0){
	cout << "False";}
else{cout << "True";}
}


